<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <title>多组件切换</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例31】多组件切换</h2>
<hr>
<div id="app">
    <a href="#" @click.prevent="comName='c登录'">登录</a>
    <a href="#" @click.prevent="comName='c注册'">注册</a>
    <a href="#" @click.prevent="comName='关于'">关于</a>
    <hr>
    <component v-bind:is="comName"></component>
</div>
<script>
    Vue.component('c登录', {
        template: '<div>登录页面</div>'
    });
    Vue.component('c注册', {
        template: '<div>注册页面</div>'
    });
    Vue.component('关于', {
        template: '<div>关于页面</div>'
    });

    let vm = new Vue({
        el: '#app',
        data: {comName: ''}
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
